<template>
  <div id="left3"></div>
</template>
<script>
import * as echarts from "echarts";

export default {
  data() {
    return {};
  },
  methods: {},
  components: {},
  computed: {},
  watch: {},
  created() {},
  async mounted() {
    
    var chartDom = document.getElementById("left3");
    var myChart = echarts.init(chartDom);
    window.onresize = function() {
      myChart.resize()
    }
    var dataStyle = {
      normal: {
        label: {
          show: false,
        },
        labelLine: {
          show: false,
        },
        shadowBlur: 40,
        shadowColor: "rgba(40, 40, 40,0.5)",
      },
    };

    var option = {
      color: ["#1089e7", "#f57474"],

      title: {
        text: "大洲感染人数饼状图",
        x: "center",
        textStyle: {
          color: "#fff",
          fontSize: "22",
        },
      },

      tooltip: {
        trigger: "item",
        formatter: "{a} <br/>{b}: {c} ({d}%)",
      },
      series: [
        {
          name: "感染地区人数",
          type: "pie",
          radius: ["50", "70%"],
          avoidLabelOverlap: false,
          itemStyle: dataStyle,
          label: {
            normal: {
              show: false,
              position: "center",
            },
            emphasis: {
              show: true,
              formatter: function (param) {
                return param.percent.toFixed(0) + "%";
              },
              textStyle: {
                fontSize: "30",
                fontWeight: "bold",
              },
            },
          },
          labelLine: {
            normal: {
              show: true,
            },
          },
          data: [
            {
              value: 8888888,
              name: "欧洲",
            },
            {
              value: 1000000,
              name: "北美洲",
            },
          ],
        },
      ],
    };
    option && myChart.setOption(option);
  },
};
</script>
<style lang="scss" scoped>
#left3 {
  width: 100%;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
}
</style>
